package com.atguigu.gulimall.product.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author majinhui
 * @description
 * @create 2024/7/22 23:05
 **/
@Configuration
@EnableTransactionManagement // 开启事务
public class MybatisConfiguration {

    @Bean
    public PaginationInterceptor mybatisPlusInterceptor() {
        PaginationInterceptor interceptor = new PaginationInterceptor();
        //设置请求的页面大于最大页后操作，true回到首页，false继续请求 默认false
        interceptor.setOverflow(true);
        // 设置单页最大行数限制，默认500条， -1 不受限制
        interceptor.setLimit(1000);
        return interceptor;
    }

}
